//
//  MenuButtonCell.m
//  VICKY ZONE
//
//  Created by sunx on 15/4/5.
//  Copyright (c) 2015年 sunx. All rights reserved.
//

#import "MenuButtonCell.h"

@implementation MenuButtonCell
+(MenuButtonCell *)buttonWithTitle:(NSString *)title andAction:(dispatch_block_t)actionBlock {
    OrganicCell *cell = [OrganicCell cellWithStyle:UITableViewCellStyleDefault height:10 actionBlock:actionBlock];
    UIColor *defaultColor = [UIColor colorWithRed:189.0/255.0 green:189.0/255.0 blue:189.0/255.0 alpha:1];
    UIColor *textColor = [UIColor colorWithRed:242.0/255.0 green:242.0/255.0 blue:242.0/255.0 alpha:1];

    CGRect rect = [ UIScreen mainScreen ].applicationFrame;
    float width = rect.size.width;
    float height = rect.size.height;
    
    UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(width*0.15, 0, width * 0.7, height*0.08)];
    
    label.backgroundColor = [UIColor clearColor];
    label.textAlignment = NSTextAlignmentCenter;
    label.textColor = textColor;
    label.layer.cornerRadius = 5;
    label.layer.masksToBounds=YES;
    label.layer.borderWidth = 2;
    label.layer.borderColor = defaultColor.CGColor;
    label.text = title;
    
    [cell addSubview:label];
    
    cell.backgroundColor = [UIColor clearColor];

    cell.height = height * 0.08;
    return (MenuButtonCell*)cell;
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
